/**
 * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
 * For licensing, see https://ckeditor.com/legal/ckeditor-oss-license
 */

CKEDITOR.editorConfig = function (config) {
    // Define changes to default configuration here.
    // For complete reference see:
    // https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html

    config.disableNativeSpellChecker = false;
    config.fullPage = false;
    config.dialog_noConfirmCancel = true;
    //config.enableContextMenu = false;
    //config.tabSpaces = 4;
    //config.height = 350;
    // config.extraPlugins = 'autosave,iframe,mediaembed,embed,
    config.extraPlugins =
        'liststyle,colordialog,autosave,autogrow,stylescombo,mathjax,mmscf,mmscomment,mmsvlink,mmsreset,mmssignature,mmsdropdown,sourcedialog';
    config.autoGrow_minHeight = 200;
    config.autoGrow_maxHeight = 600;
    config.autoGrow_bottomSpace = 50;
    config.autoGrow_onStartup = true;
    config.startupFocus = 'end';
    config.mathJaxLib = 'mathjax/tex-mml-chtml.js';
    config.mathJaxVer = 'v3';
    config.allowedContent = true;
    config.specialChars = [
        '&euro;',
        '&lsquo;',
        '&rsquo;',
        '&ldquo;',
        '&rdquo;',
        '&ndash;',
        '&mdash;',
        '&iexcl;',
        '&cent;',
        '&pound;',
        '&curren;',
        '&yen;',
        '&brvbar;',
        '&sect;',
        '&uml;',
        '&copy;',
        '&ordf;',
        '&laquo;',
        '&not;',
        '&reg;',
        '&macr;',
        '&deg;',
        '&sup2;',
        '&sup3;',
        '&acute;',
        '&micro;',
        '&para;',
        '&middot;',
        '&cedil;',
        '&sup1;',
        '&ordm;',
        '&raquo;',
        '&frac14;',
        '&frac12;',
        '&frac34;',
        '&iquest;',
        '&Agrave;',
        '&Aacute;',
        '&Acirc;',
        '&Atilde;',
        '&Auml;',
        '&Aring;',
        '&AElig;',
        '&Ccedil;',
        '&Egrave;',
        '&Eacute;',
        '&Ecirc;',
        '&Euml;',
        '&Igrave;',
        '&Iacute;',
        '&Icirc;',
        '&Iuml;',
        '&ETH;',
        '&Ntilde;',
        '&Ograve;',
        '&Oacute;',
        '&Ocirc;',
        '&Otilde;',
        '&Ouml;',
        '&times;',
        '&Oslash;',
        '&Ugrave;',
        '&Uacute;',
        '&Ucirc;',
        '&Uuml;',
        '&Yacute;',
        '&THORN;',
        '&szlig;',
        '&agrave;',
        '&aacute;',
        '&acirc;',
        '&atilde;',
        '&auml;',
        '&aring;',
        '&aelig;',
        '&ccedil;',
        '&egrave;',
        '&eacute;',
        '&ecirc;',
        '&euml;',
        '&igrave;',
        '&iacute;',
        '&icirc;',
        '&iuml;',
        '&eth;',
        '&ntilde;',
        '&ograve;',
        '&oacute;',
        '&ocirc;',
        '&otilde;',
        '&ouml;',
        '&divide;',
        '&oslash;',
        '&ugrave;',
        '&uacute;',
        '&ucirc;',
        '&uuml;',
        '&yacute;',
        '&thorn;',
        '&yuml;',
        '&OElig;',
        '&oelig;',
        '&#372;',
        '&#374',
        '&#373',
        '&#375;',
        '&sbquo;',
        '&#8219;',
        '&bdquo;',
        '&hellip;',
        '&trade;',
        '&#9658;',
        '&bull;',
        '&rarr;',
        '&rArr;',
        '&hArr;',
        '&diams;',
        '&asymp;',
        '&alpha;',
        '&beta;',
        '&gamma;',
        '&delta;',
        '&epsilon;',
        '&zeta;',
        '&eta;',
        '&theta;',
        '&iota;',
        '&kappa;',
        '&lambda;',
        '&mu;',
        '&nu;',
        '&xi;',
        '&omicron;',
        '&pi;',
        '&rho;',
        '&sigma;',
        '&tau;',
        '&upsilon;',
        '&phi;',
        '&chi;',
        '&psi;',
        '&omega;',
        '&Alpha;',
        '&Beta;',
        '&Gamma;',
        '&Delta;',
        '&Epsilon;',
        '&Zeta;',
        '&Eta;',
        '&Theta;',
        '&Iota;',
        '&Kappa;',
        '&Lambda;',
        '&Mu;',
        '&Nu;',
        '&Xi;',
        '&Omicron;',
        '&Pi;',
        '&Rho;',
        '&Sigma;',
        '&Tau;',
        '&Upsilon;',
        '&Phi;',
        '&Chi;',
        '&Psi;',
        '&Omega;',
    ];
    //config.protectedSource.push( /<i[^>]*><\/i>/g );

    // Enhanced Image config
    config.image2_alignClasses = ['image-left', 'image-center', 'image-right'];
    config.filebrowserUploadUrl = '/alfresco.php';
    config.uploadUrl = '/alfresco.php';

    // Remove some buttons provided by the standard plugins, which are
    // not needed in the Standard(s) toolbar.
    config.removeButtons = 'Underline,Subscript,Superscript,Blockquote';

    // Set the most common block elements.
    config.format_tags = 'p;h1;h2;h3;pre';

    // Simplify the dialog windows.
    config.removeDialogTabs = 'image:advanced;link:advanced';

    config.stylesSet = [
        { name: 'Paragraph', element: 'p' },
        { name: 'Heading 1', element: 'h1' },
        { name: 'Heading 2', element: 'h2' },
        { name: 'Heading 3', element: 'h3' },
        { name: 'Heading 4', element: 'h4' },
        { name: 'Heading 5', element: 'h5' },
        { name: 'Heading 6', element: 'h6' },
        { name: 'Preformatted Text', element: 'pre' },
        { name: 'Computer Code', element: 'code' },
    ];
};
